// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_INV_COI
// * CreateDate    : 2013-12-20 23:31:42
// * Creater       : CodeSmith
// * LastChangeDate: 2013-12-20 23:31:42
// * LastChanger   : 2013-12-20 23:31:42
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Inv
{
/// <summary>
    /// InvCoi
    /// </summary>
    public partial class InvCoiBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objInvCoiEntity">Entity</param>
        /// <returns>Entity</returns>
        public static InvCoiEntity GetInvCoi(InvCoiEntity objInvCoiEntity)
        {
            return DataAccess.SelectSingle<InvCoiEntity>(objInvCoiEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objInvCoiEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertInvCoi(InvCoiEntity objInvCoiEntity)
        {
            return DataAccess.Insert(objInvCoiEntity);
        }

        public static bool InsertInvCoi(List<InvCoiEntity> objInvCoiEntityList)
        {
            return DataAccess.Insert(objInvCoiEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objInvCoiEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateInvCoi(InvCoiEntity objInvCoiEntity)
        {
            return DataAccess.Update(objInvCoiEntity);
        }

        public static bool UpdateInvCoi(List<InvCoiEntity> objInvCoiEntityList)
        {
            return DataAccess.Update<InvCoiEntity>(objInvCoiEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objInvCoiEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteInvCoi(InvCoiEntity objInvCoiEntity)
        {
            return DataAccess.Delete(objInvCoiEntity);
        }

        public static bool DeleteInvCoi(List<InvCoiEntity> objInvCoiEntityList)
        {
            return DataAccess.Delete<InvCoiEntity>(objInvCoiEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetInvCoiAll()
        {
            return DataAccess.SelectAllDataSet<InvCoiEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<InvCoiEntity> GetInvCoiAllList()
        {
            return DataAccess.SelectAll<InvCoiEntity>();
        }
        #endregion

        public static DataSet GetAllDsBySql(string sql)
        {
            return DataAccess.SelectDataSet(sql);
        }

        public static bool Save(List<InvCoiEntity> adds, List<InvCoiEntity> updates)
        {
            using (DataAccessBroker broker = DataAccessFactory.Instance())
            {
                try
                {
                    broker.BeginTransaction();
                    DataAccess.Insert(adds, broker);
                    DataAccess.Update(updates, broker);
                    broker.Commit();
                    return true;
                }
                catch (Exception ex)
                {
                    broker.RollBack();
                    throw ex;
                }
            }
        }

	}
	
	
}	

